home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / SNNSV32.ZIP / SNNSv3.2 / xgui / sources / d3_point.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-25  |  3.2 KB  |  152 lines

  1. /*****************************************************************************
  2.   FILE           : d3_point.c
  3.   SHORTNAME      : point.c
  4.   SNNS VERSION   : 3.2
  5.  
  6.   PURPOSE        : low level pixel IO
  7.   NOTES          :
  8.  
  9.   AUTHOR         : Ralf Huebner
  10.   DATE           : 1.12.1991
  11.  
  12.   CHANGED BY     :
  13.   IDENTIFICATION : @(#)d3_point.c    1.10 3/2/94
  14.   SCCS VERSION   : 1.10
  15.   LAST CHANGE    : 3/2/94
  16.  
  17.              Copyright (c) 1990-1994  SNNS Group, IPVR, Univ. Stuttgart, FRG
  18.              
  19. ******************************************************************************/
  20.  
  21.  
  22. #include <X11/Xlib.h>
  23. #include <X11/X.h>
  24. #include <X11/Xutil.h>
  25. #include <X11/Xos.h>
  26.  
  27. #include "glob_typ.h"
  28. #include "d3_global.h"
  29. #include "d3_dither.h"
  30.  
  31.  
  32. #undef BUFFERED_IO
  33.  
  34.  
  35. #include "d3_point.ph"
  36.  
  37.  
  38. #ifdef BUFFERED_IO
  39.  
  40.  
  41. /*****************************************************************************
  42.   FUNCTION : d3_putPixel
  43.  
  44.   PURPOSE  : draw a pixel
  45.   RETURNS  : void
  46.   NOTES    : the pixels are buffered in the points array
  47.  
  48.   UPDATE   :
  49. ******************************************************************************/
  50.  
  51. void d3_putPixel (int xp, int yp)
  52.  
  53. {
  54.     points[point_count].x = (short) xp;
  55.     points[point_count].y = (short) yp;
  56.     point_count++;
  57.     if (point_count == POINT_BLOCK_SIZE) {
  58.         XDrawPoints (d3_display, d3_window, d3_gc, points, 
  59.                      point_count, 0);
  60.         point_count = 0;
  61.     }
  62. }
  63.  
  64.  
  65. /*****************************************************************************
  66.   FUNCTION : d3_flushPixels
  67.  
  68.   PURPOSE  : draw the remaining pixels
  69.   RETURNS  : void
  70.   NOTES    :
  71.  
  72.   UPDATE   :
  73. ******************************************************************************/
  74.  
  75. void d3_flushPixels (void)
  76.  
  77. {
  78.     XDrawPoints (d3_display, d3_window, d3_gc, points, 
  79.                  point_count, 0);
  80.     point_count = 0;
  81. }
  82.  
  83.  
  84. #else /* BUFFERED_IO */
  85.  
  86.  
  87. /*****************************************************************************
  88.   FUNCTION : d3_putPixel
  89.  
  90.   PURPOSE  : draw a pixel
  91.   RETURNS  : void
  92.   NOTES    :
  93.  
  94.   UPDATE   :
  95. ******************************************************************************/
  96.  
  97. void d3_putPixel (int xp, int yp)
  98.  
  99. {
  100.     XDrawPoint (d3_display, d3_window, d3_gc, xp, yp);
  101. }
  102.  
  103.  
  104. /*****************************************************************************
  105.   FUNCTION : d3_putColPixel
  106.  
  107.   PURPOSE  : draw a color pixel
  108.   RETURNS  : void
  109.   NOTES    : dither if monchrome mode
  110.  
  111.   UPDATE   :
  112. ******************************************************************************/
  113.  
  114. void d3_putColPixel (int xp, int yp)
  115.  
  116. {
  117.     unsigned long color;
  118.  
  119.     if (d3_state.color_mode == mono_mode) {
  120.         if (dither (xp, yp, d3_intens))
  121.             color = WhitePixel (d3_display, d3_screen);
  122.         else
  123.             color = BlackPixel (d3_display, d3_screen);
  124.         XSetForeground(d3_display, d3_gc, color); 
  125.     }
  126.     XDrawPoint (d3_display, d3_window, d3_gc, xp, yp);
  127. }
  128.  
  129.  
  130. /*****************************************************************************
  131.   FUNCTION : d3_flushPixels
  132.  
  133.   PURPOSE  :
  134.   RETURNS  : void
  135.   NOTES    :
  136.  
  137.   UPDATE   :
  138. ******************************************************************************/
  139.  
  140. void d3_flushPixels (void)
  141.  
  142. {
  143. }
  144.  
  145.  
  146. #endif /* BUFFERED_IO */
  147.  
  148.  
  149.  
  150. /* end of file */
  151. /* lines: 178 */
  152.